package com.meitianhui.convenitenbuy.module.wallet.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.meitianhui.convenitenbuy.R;
import com.meitianhui.convenitenbuy.module.wallet.model.PropertyBean;

import java.util.List;

/**
 * Created by Administrator on 2017/11/3.
 * 拼团领
 */
public class WalletGoldAdapter extends BaseQuickAdapter<PropertyBean, BaseViewHolder> {
    private Context context;

    public WalletGoldAdapter(Context context, List<PropertyBean> data) {
        super(R.layout.item_wallet_change, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, PropertyBean trade) {
        if (trade != null) {
            helper.setText(R.id.tv_wallet_change_item_content, TextUtils.isEmpty(trade.getDetail()) ? context.getString(R.string.wallet_change_detail) : trade.getDetail());
            String amount = trade.getAmount();
            helper.setText(R.id.tv_wallet_change_item_num, TextUtils.isEmpty(amount) ? context.getString(R.string.wallet_zero_decimal) : (amount.contains("-") ? amount : "+" + amount));
            helper.setText(R.id.tv_wallet_change_item_time, TextUtils.isEmpty(trade.getTransaction_date()) ? "" : trade.getTransaction_date());
        }

    }

}
